package org.ali.creationalpattern.factorypattern;

import org.ali.creationalpattern.factorypattern.color.Color;
import org.ali.creationalpattern.factorypattern.color.Green;
import org.ali.creationalpattern.factorypattern.color.Red;

/**
 * 工厂
 */
public class ColorFactory {
    /**
     * 获取颜色
     */
    public static Color getColor(String message) {
        return switch (message) {
            case "Red" -> new Red();
            case "Green" -> new Green();
            default -> null;
        };
    }
}
